import { apiList } from "@/api/apiList"
import type { IUser } from "@shared/types/user"

export default function(){
    const createUser = async (user: Omit<IUser, '_id' | 'create_time'>) => {
        const res = await apiList.user.createUser(user)
        console.log("res:", res)
        return res.data
    }

    const deleteUser = async (id: string) => {
        const res = await apiList.user.deleteUser(id)
        console.log("res", res)
        return res.data
    }

    const updateUser = async (data: Partial<IUser> & { id: string }) => {
        const res = await apiList.user.updateUser(data)
        return res.data
    }

    return {
        createUser,
        deleteUser,
        updateUser,
    }
}
